package test;

import com.google.code.ssm.api.ParameterValueKeyProvider;
import com.google.code.ssm.api.ReadThroughSingleCache;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;

/**
 * Created by dws on 2018/3/30.
 */
@Component
public class DemoCache {
    @Cacheable(value = "test")
    public String get(String key){
        System.err.println("from db");
        return "helloworld";
    }
    @ReadThroughSingleCache(namespace = "item", expiration = 3600)
    public Object getComplexObjectFromDB(@ParameterValueKeyProvider Long complexObjectPk) {
        System.out.println("from db");
        return "simple-memcached-demo";
    }
}
